package com.driver.fordriver;

import android.content.Intent;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.driver.fordriver.activity.LoginActivity;
import com.driver.fordriver.util.Commands;


public class MainActivity extends AppCompatActivity {

    Handler handler=new Handler(){
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case Commands.HANDLER_GO_LOGIN:
                    //跳转到LoginActivity
                    Intent mIntent = new Intent( getApplicationContext(), LoginActivity.class);
                    startActivity(mIntent);
                    finish();
                    break;
            }
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //延迟2s打开登录界面
        handler.sendEmptyMessageDelayed(Commands.HANDLER_GO_LOGIN,2000);
    }
}
